package Tree;

public class BinaryNode<T extends Comparable<? super T>> {
    public T data;
    public BinaryNode<T> left,right;

    public BinaryNode() {}

    public BinaryNode(T data) {
        this.data = data;
    }

    public BinaryNode(T data, BinaryNode<T> left, BinaryNode<T> right) {
        this.data = data;
        this.left = left;
        this.right = right;
    }

    public T getData() {
        return data;
    }

    public void setData(T data) {
        this.data = data;
    }

    @Override
    public String toString() {
        return  "结点为"+this.data+"\t";
    }

    public boolean isLeaf(){
        return left==null&&right==null;
    }
}
